﻿using HighDiveEngine.Aggregates;
using HighDiveEngine.Model;
using HighDiveEngine.Resources;
using NUnit.Framework;

namespace UnitTestHighDive
{
    [TestFixture]
    class UnitTestJudgeList
    {
        private JudgeList judgeList;
        [SetUp]
        public void SetUp()
        {
            UnitTestMockObjects.ResetObjects();
            judgeList = new JudgeList(2);
        }

        [Test]
        public void TestConstructor()
        {
            int size = 3;
            JudgeList j = new JudgeList(size);
            Assert.AreEqual(size, j.NumberOfJudges);
        }

        [Test]
        public void TestAdd()
        {
            Assert.AreEqual(0, judgeList.Count);
            judgeList.Add(UnitTestMockObjects._judge1);
            Assert.AreEqual(1, judgeList.Count);
            judgeList.Add(UnitTestMockObjects._judge2);
            Assert.Throws(typeof (JudgeListException),() => judgeList.Add(UnitTestMockObjects._judge3));
        }
        [Test]
        public void TestGenerateIdStrings()
        {
            UnitTestMockObjects._contest1.JudgeList.GenerateIdStrings();
            Assert.AreEqual(false, UnitTestMockObjects._contest1.JudgeList[0].IdString == null);

            Assert.Throws(typeof(JudgeListException), () => judgeList.GenerateIdStrings());
        }
    }
}
